/**
 * Copyright (c) 2011 eelpo.com
 * All rights reserved.
 */
package com.eelpo.cmmp.core.wicket.page.extensions;

import org.apache.wicket.markup.html.panel.Panel;

import com.eelpo.cmmp.core.wicket.page.basic.DeniedPage;
import com.eelpo.cmmp.core.wicket.panel.container.SearchContentContainer;

/**
 * <pre>
 * 
 * 搜索列表基类页面
 * 
 * </pre>
 * 
 * @author <a href="mailto:Brian@eelpo.com">汪洪州</a>
 * @since 1.0
 */
public abstract class SerachContentWebPage<T> extends DeniedPage {

	/**
	 * 查询参数对象
	 */
	protected T parameter;

	/**
	 * @param parameter
	 */
	public SerachContentWebPage(String title, T parameter) {

		this.parameter = parameter;

		// 搜索列表面板
		add(renderSearchContentContainer("container", title));
	}

	public Panel renderSearchContentContainer(String id, String title) {
		return new SearchContentContainer<T>(id, title) {

			/**
			 * serialVersionUID
			 */
			private static final long serialVersionUID = -6721272925143913463L;

			@Override
			public Panel renderSearchPanel(String id) {
				return SerachContentWebPage.this.renderSearchPanel(id);
			}

			@Override
			public Panel renderSearchContentPanel(String id) {
				return SerachContentWebPage.this.renderSearchContentPanel(id);
			}
		};
	}

	public abstract Panel renderSearchPanel(String id);

	public abstract Panel renderSearchContentPanel(String id);

	public T getParameter() {
		return parameter;
	}
}
